home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5145 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.9 KB

  1. Path: news.tau.ac.il!usenet
  2. From: Avi Lev <avil@sapiens.com>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: 680X0 -> PPC translator?
  5. Date: Mon, 11 Mar 1996 10:31:39 +0200
  6. Organization: Sapiens Technologies
  7. Message-ID: <3143E4EB.7303@sapiens.com>
  8. References: <4h4fk6$f7a@maze.ruca.ua.ac.be> <19960229.43A058.11BCF@am090.du.pipex.com> <313D3A8F.148C@sapiens.com> <volker.0fpv@vb.franken.de>
  9. NNTP-Posting-Host: honda.sapiens.co.il
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Volker Barthelmann wrote:
  16. > Avi Lev (avil@sapiens.com) wrote:
  17. > :
  18. > : Hi, IMHO, the way i would try to solve the problem is by going
  19. > : through all the programs' segments picking up all the different
  20. > : calls which are addressed to the program itself (not to outside
  21. > : libraries or devices), which is easy to solve cuz every such
  22. > : call must use the A6 as the base register and so every other
  23. > : call is to code within the program, then all there's to be done
  24. > This is completely wrong. External calls don't have to use a6 as base
  25. > register and calls with a6 as base don't have to go outside.
  26. > And the called address can be calculated during program execution.
  27. > Volker
  28.  
  29. Well, even so it still doesn't affect the translation process and that's simply becuase in 
  30. order to make a dynamic call (ie run-time address calc.) the base address of the function is 
  31. referenced somewhere in the program right?! so you can collect all these addresses and then see 
  32. where they're used as jump/call operands in an indirect call somewhere else in the program. 
  33. remember that all such addresses are 'lea'ed somewhere in the program and probably stored in 
  34. some variable in memory and when needed is used to load an address register for making the jump 
  35. or simply used directly, in either case to resolve the problem of dynamic address resolution, 
  36. address context analysis must be performed on EACH such address in the program, while it 
  37. implies hugh data structures, it is very much theoratically possible. also bear in mind that 
  38. all external references are assumed to be translated code already, so we don't care about that 
  39. but ALL internal references can be resolved because SOMEWHERE, SOMEONE must have used them and 
  40. don't tell me that function addresses are being used in arithmatic calculations, that is simply 
  41. weird programming, don't you agree and so the exact entry point is located somewhere in the 
  42. program, hey no one said that the translator has to be a stupid one, hell no, it is pretty much 
  43. intelligent in that respect, that is one of the fields in which it excels i think, to be able 
  44. to resolve dynamic addresses. if the branch is to some externally allocated memory, in which 
  45. case you don't have an address, then this falls under the heading of self 
  46. modifying/relocating code and then you have to simply change the source bytes, meaning the 
  47. code bytes being copied to PPC code ofcourse, however a problem arises if the code size differs 
  48. from the translated code size, then you'll have to locate the code that does the copying and 
  49. modify it accordinly which i admit can present a barrier but hey, for an entry level translator 
  50. it does provide alot of answers to most other problems, right?! i think that some run-time 
  51. solution must be provided in that case, meaning that if the translated program, running under a 
  52. PPC enounters a 680x0 instruction, that should trigger an exception which then translates 
  53. the code and continues as if nothing had happened, but the processor has to support that at 
  54. the hardware level, otherwise more advanced algorithm are needed. and as for distinguishing 
  55. data residing in code hunk, nothing could be simpler than simply simulating the running of the 
  56. program (ie following its flow) and again make intelligent decision based on the context of all 
  57. memory locations used in the program, if a memory area is used for i/o but not for execution 
  58. it's a data section otherwise it's a code section.
  59.